-
The
MGLFeatureprotocol is used to provide details about geographic features contained in anMGLShapeSourceorMGLVectorSourceobject. Each concrete subclass ofMGLShapein turn has a subclass that conforms to this protocol. A feature object associates a shape with an optional identifier and attributes.You can add custom data to display on the map by creating feature objects and adding them to an
MGLShapeSourceusing the-[MGLShapeSource initWithIdentifier:shape:options:]method orMGLShapeSource.shapeproperty. Similarly, you can addMGLPointFeature,MGLPolylineFeature, andMGLPolygonFeatureobjects to the map as annotations using-[MGLMapView addAnnotations:]and related methods.In addition to adding data to the map, you can also extract data from the map:
See more-[MGLMapView visibleFeaturesAtPoint:]and related methods return feature objects that correspond to features in the source. This enables you to inspect the properties of features in vector tiles loaded byMGLVectorSourceobjects. You also reuse these feature objects as overlay annotations.Declaration
Objective-C
@protocol MGLFeature <MGLAnnotation>Swift
protocol MGLFeature : MGLAnnotation -
An
MGLPointFeatureobject associates a point shape with an optional identifier and attributes.Declaration
Objective-C
@interface MGLPointFeature : MGLPointAnnotation <MGLFeature>Swift
class MGLPointFeature : MGLPointAnnotation, MGLFeature -
An
MGLPolygonFeatureobject associates a polygon shape with an optional identifier and attributes.Declaration
Objective-C
@interface MGLPolygonFeature : MGLPolygon <MGLFeature>Swift
class MGLPolygonFeature : MGLPolygon, MGLFeature -
An
MGLPolylineFeatureobject associates a polyline shape with an optional identifier and attributes.A polyline feature is known as a LineString feature in GeoJSON.
Declaration
Objective-C
@interface MGLPolylineFeature : MGLPolyline <MGLFeature>Swift
class MGLPolylineFeature : MGLPolyline, MGLFeature -
An
MGLMultiPolygonFeatureobject associates a multipolygon shape with an optional identifier and attributes.Declaration
Objective-C
@interface MGLMultiPolygonFeature : MGLMultiPolygon <MGLFeature>Swift
class MGLMultiPolygonFeature : MGLMultiPolygon, MGLFeature -
An
MGLMultiPolylineFeatureobject associates a multipolyline shape with an optional identifier and attributes.A multipolyline feature is known as a MultiLineString feature in GeoJSON.
Declaration
Objective-C
@interface MGLMultiPolylineFeature : MGLMultiPolyline <MGLFeature>Swift
class MGLMultiPolylineFeature : MGLMultiPolyline, MGLFeature -
An
MGLPointCollectionFeatureobject associates a point collection with an optional identifier and attributes.A point collection feature is known as a MultiPoint feature in GeoJSON.
Declaration
Objective-C
@interface MGLPointCollectionFeature : MGLPointCollection <MGLFeature>Swift
class MGLPointCollectionFeature : MGLPointCollection, MGLFeature -
An
MGLShapeCollectionFeatureobject associates a shape collection with an optional identifier and attributes.A shape collection feature is known as a feature collection in GeoJSON.
Declaration
Objective-C
@interface MGLShapeCollectionFeature : MGLShapeCollection <MGLFeature>Swift
class MGLShapeCollectionFeature : MGLShapeCollection, MGLFeature
Install in Dash
Content Primitives Reference